﻿using MediatR;
using T_vehicle.Domain;
using T_vehicle.Infrastructure.Interfacec;
using T_vehicle.Read.API.Application.Command.TiresUsedCommand;

namespace T_vehicle.Read.API.Application.CommandHandlers.TiresUsedCommandHandlers
{
    public class FanTiresUsedCommandHandlers : IRequestHandler<FanTiresUsedCommand, TiresUsed>
    {
        private readonly ITiresUsedRepository tiresUsedRepository;

        public FanTiresUsedCommandHandlers(ITiresUsedRepository tiresUsedRepository)
        {
            this.tiresUsedRepository = tiresUsedRepository;
        }

        public async Task<TiresUsed> Handle(FanTiresUsedCommand request, CancellationToken cancellationToken)
        {
            var list = tiresUsedRepository.GetModelAsync(request.TiresUsedId);
            return await list;
        }
    }

}
